package com.railway.switchs.config;

import com.railway.switchs.constant.FileConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebAppConfig
 * @Author 魏梓晟
 * @Version 1.0
 **/
@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    @Value("${file.upload.path}")
    private String path ;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(FileConstant.FILE_PATH_MAPPING+"**")
                .addResourceLocations("file:"+path);
    }
}
